#pragma once
#include <string>
#include <ostream>
#include <istream>
#include <map>
#include "../Headers/types.h"
#include "../Headers/authr.h"
#include "../Headers/log.h"

namespace TOB {

	class FS_Client;
	class FS_Server;
	class FS_File;
	
  class FS_File {
		//methods
		public:
			FS_File();
			~FS_File();      
			ifstream& getBytes(std::string fileName, int count, char * buffer);
			uint16 close(std::string fileName);
			uint16 open(std::string fileName);
      ifstream getHandle(std::string fileName);
		private:
			std::map<std::string, std::ifstream*> file;
			int get_file_size(std::string fileName);
			uint16 create_connection(Nameserver::IP ip);
	};

	class FS_Client : public AuthRequired {
		public:
			FS_Client(std::string fileName, std::string password, Nameserver::IP ip);
			~FS_Client();
			uint16 sendFile(std::string fileName);
			uint16 download(std::string fileName, std::ostream&);
		private:
			Nameserver* ns;
			FS_File file;
	};	

	class FS_Server {
		public:
			FS_Server(std::string, std::string);
			~FS_Server();
			uint8 sendFile(std::string , std::string , std::string);
			uint8 receiveFile(std::string, std::string);
		private:
	};
}
